package com.xal.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @program: mybatisplus
 * @author: 邢奥林
 * @create: 2023-04-11 15:36
 **/
@Data

@NoArgsConstructor
//@TableName(value = "student")//实体类和表名字的映射
public class Student {
    @TableId(type = IdType.AUTO)//如果主键名不叫id 必须认为标记
    private Integer sid;
    // @TableField(value = "sname")//属性名与列明不一致
    private String sname;
    private int sage;
    private int cid;
    @TableField(exist = false)//exist 存在  默认为true 用于连表查询 false表示数据表中不存在该字段
    private Class aClass;

    @Override
    public String toString() {
        return "Student{" +
                "sid=" + sid +
                ", sname='" + sname + '\'' +
                ", sage=" + sage +
                ", cid=" + cid +
                '}';
    }

    public Student(String sname, int sage, int cid) {

        this.sname = sname;
        this.sage = sage;
        this.cid = cid;
    }
}
